import service from '@/utils/request'
import type { GetArtistListApi } from './modules/singerModel'
import { GetArtistListParams } from './modules/singerModel'

enum Api {}
/*
 *******歌手列表******
 */
/*
 * 给评论点赞
 * type: -1:全部; 1:男歌手; 2:女歌手; 3:乐队
 * area: -1:全部; 7华语; 96欧美; 8:日本; 16韩国; 0:其他
 * initial: 按首字母索引查找参数, 热门传-1, 其他传0
 * limit: 30
 * offset: 0
 */
export const reqArtistList = ({
  type = '-1',
  area = '-1',
  initial = '-1',
  limit = 50,
  offset = 0,
}: GetArtistListParams) => {
  return service.get<any, GetArtistListApi>(
    `/artist/list?type=${type}&area=${area}&initial=${initial}&limit=${limit}&offset=${offset}`,
    {}
  )
}
// 热门歌手
export const reqTopArtists = ({ limit = 0, offset = 0 }) => {
  return service.get<any, GetArtistListApi>(
    `/top/artists?limit=${limit}&offset=${offset}`,
    {}
  )
}

/*
 *******歌手详情******
 */
// 歌手热门歌曲
export const artists = ({ id = '' }) => {
  return service.get(`/artists?id=${id}`, {})
}
// 获取歌手专辑
export const artistAlbum = ({ id = '', limit = 50, offset = 0 }) => {
  return service.get(
    `/artist/album?id=${id}&limit=${limit}&offset=${offset}`,
    {}
  )
}
// 歌手介绍
export const artistDesc = ({ id = '' }) => {
  return service.get(`/artist/desc?id=${id}`, {})
}

// 获取歌手 mv
export const artistMv = ({ id = '', limit = 50, offset = 0 }) => {
  return service.get(`/artist/mv?id=${id}&limit=${limit}&offset=${offset}`, {})
}
// 收藏/取消收藏歌手
export const artistSub = ({ id = '', t = '1' }) => {
  return service.get(`/artist/sub?id=${id}&t=${t}`, {})
}
// 收藏的歌手列表
export const subArtist = () => {
  return service.get('/artist/sublist', {})
}

/* ********* MV ********* */
// 获取 mv
export const mv = ({
  area = '',
  type = '',
  order = '',
  limit = 50,
  offset = 0,
}) => {
  return service.get(
    `/mv/all?area=${area}&type=${type}&order=${order}&limit=${limit}&offset=${offset}`,
    {}
  )
}
// 获取 mv详情
export const mvDetail = ({ id = '' }) => {
  return service.get(`/mv/detail?mvid=${id}`, {})
}
// 获取 地址
export const mvUrl = ({ id = '', r = 1080 }) => {
  return service.get(`/mv/url?id=${id}&r=${r}`, {})
}
// 获取mv评论
export const commentMv = ({
  id = '',
  limit = 20,
  offset = 0,
  before = 0,
  timestamp = 0,
}) => {
  return service.get(
    `/comment/mv?id=${id}&limit=${limit}&offset=${offset}&before=${before}&timestamp=${timestamp}`,
    {}
  )
}
// 相似mv
export const simiMv = ({ id = '' }) => {
  return service.get(`/simi/mv?mvid=${id}`, {})
}
